Hi, |
Re: Word Export
Maybe you should take a close look at the Word Object Model. Also it can help, to try doing stuff like this in VBA before switching to DXL, since in VBA you can experiment much better with the properties of the word objects, you got stuff like autocompletion in the editor, which will immediately tell you what properties exist on an object. To use the 'type...' methods you need a Selection object which is a property of the Word.Application object. Therefore the code needs to look like this:
//Assign the variables
//--------------------------------Include Files------------------------------------------------------------
#include <utils/ole.inc>
#include <utils/doctools/itfutil.inc>
Object o = current
Module m = current
string g = "Object Text"
void TryOLE(string s, string info)
{
if(s == null) return
print info "\n"
print s "\n"
}
OleAutoObj theWordApp = null
OleAutoObj objWordDocs = null, objDoc = null
OleAutoObj objSelection = null
OleAutoArgs autoArgs = create
bool docVisible
// create the app
theWordApp = oleCreateAutoObject("Word.Application")
// don't care if it is already visible ...
olePut (theWordApp, "visible", true)
// Get ActiveDocument.Selection
TryOLE(oleGet(theWordApp,cPropertyDocuments,objWordDocs), "Getting Documents")
TryOLE(oleMethod(objWordDocs, cMethodAdd, autoArgs, objDoc), "Adding Document")
oleCloseAutoObject objWordDocs // nicely clean up .
TryOLE(oleGet(theWordApp, "Selection", objSelection), "Getting Selection")
clear autoArgs
put(autoArgs, "adjahksdjhd")
TryOLE(oleMethod(objSelection, "TypeText", autoArgs), "Typin ...")
TryOLE(oleMethod(objSelection, "TypeParagraph"), "Doin a paragraph")
clear autoArgs
put(autoArgs, "And a new one ...")
TryOLE(oleMethod(objSelection, "TypeText", autoArgs), "Typin some more")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Word Export Mathias Mamsch - Sat Jul 16 09:23:20 EDT 2011
Maybe you should take a close look at the Word Object Model. Also it can help, to try doing stuff like this in VBA before switching to DXL, since in VBA you can experiment much better with the properties of the word objects, you got stuff like autocompletion in the editor, which will immediately tell you what properties exist on an object. To use the 'type...' methods you need a Selection object which is a property of the Word.Application object. Therefore the code needs to look like this:
//Assign the variables
//--------------------------------Include Files------------------------------------------------------------
#include <utils/ole.inc>
#include <utils/doctools/itfutil.inc>
Object o = current
Module m = current
string g = "Object Text"
void TryOLE(string s, string info)
{
if(s == null) return
print info "\n"
print s "\n"
}
OleAutoObj theWordApp = null
OleAutoObj objWordDocs = null, objDoc = null
OleAutoObj objSelection = null
OleAutoArgs autoArgs = create
bool docVisible
// create the app
theWordApp = oleCreateAutoObject("Word.Application")
// don't care if it is already visible ...
olePut (theWordApp, "visible", true)
// Get ActiveDocument.Selection
TryOLE(oleGet(theWordApp,cPropertyDocuments,objWordDocs), "Getting Documents")
TryOLE(oleMethod(objWordDocs, cMethodAdd, autoArgs, objDoc), "Adding Document")
oleCloseAutoObject objWordDocs // nicely clean up .
TryOLE(oleGet(theWordApp, "Selection", objSelection), "Getting Selection")
clear autoArgs
put(autoArgs, "adjahksdjhd")
TryOLE(oleMethod(objSelection, "TypeText", autoArgs), "Typin ...")
TryOLE(oleMethod(objSelection, "TypeParagraph"), "Doin a paragraph")
clear autoArgs
put(autoArgs, "And a new one ...")
TryOLE(oleMethod(objSelection, "TypeText", autoArgs), "Typin some more")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Got it working.. |
Re: Word Export Lion29 - Mon Jul 18 18:07:25 EDT 2011 |
Re: Word Export Lion29 - Thu Jul 21 20:11:27 EDT 2011 You probably need to loop over the richTextParagraphs pasting them one by one.
RichTextParagraph rp
for rp in richText obj."Object Text" do {
// export them one by one ...
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|